﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Emulator.GameBoyConfig
{
    public class GBMemoryConfig
    {
        public static Dictionary<byte, string> CartidgeType = new Dictionary<byte, string>() { 
            {0x00,"ROM Only"},
            {0x01,"MBC1"},
            {0x02,"MBC1+RAM"},
            {0x03,"MBC1+RAM+BATTERY"},
            {0x05,"MBC2"},
            {0x06,"MBC2+RAM"},
            {0x08,"ROM+RAM"},
            {0x09,"ROM+RAM+BATTERY"},
            {0x0b,"MMM01"},
            {0x0c,"MMM01+RAM"},
            {0x0d,"MMM01+RAM+BATTERY"},
            {0x0f,"MBC3+TIMER+BATTERY"},
            {0x10,"MBC3+TIMER+RAM+BATTERY"},
            {0x11,"MBC3"},
            {0x12,"MBC3+RAM"},
            {0x13,"MBC3+RAM+BATTERY"},
            {0x15,"MBC4"},
            {0x16,"MBC4+RAM"},
            {0x17,"MBC4+RAM+BATTERY"},
            {0x19,"MBC5"},
            {0x1a,"MBC5+RAM"},
            {0x1b,"MBC5+RAM+BATTERY"},
            {0x1c,"MBC5+RUMBLE"},
            {0x1e,"MBC5+RUMBLE+RAM"},
            {0xfc,"POCKET CAMERA"},
            {0xfd,"BANDAITAMA5"},
            {0xfe,"HUC3"},
            {0xff,"HUC1+RAM+BATTERY"},
        };

        public static Dictionary<byte, string> RomSize = new Dictionary<byte, string>() { 
            {0x00,"32KByte (no ROM banking)"},
            {0x01,"64Kbyte (4 banks)"},
            {0x02,"128Kbyte(8 banks)"},
            {0x03,"256Kbytes(16 banks)"},
            {0x04,"512Kbytes(32 banks)"},
            {0x05,"1Mbytes(64 banks) - only 63 banks used by MBC1"},
            {0x06,"2Mbytes(128 banks) - only 125 banks used by MBC1"},
            {0x07,"4Mbytes(256 banks)"},
            {0x52,"1.1Mbytes(72 banks)"},
            {0x53,"1.2Mbytes(80 banks)"},
            {0x54,"1.5Mbytes(96 banks)"},
        };

        public static Dictionary<byte, string> RamSize = new Dictionary<byte, string>() { 
            {0x00,"None"},
            {0x01,"82Kbytes"},
            {0x02,"8Kbytes"},
            {0x03,"32Kbytes(4banks of 8KBytes each)"},
        };

        public static int IOBaseAddress = 0xFF00;

        public static Dictionary<int, int> BitPositionMaskMap = new Dictionary<int, int>()
        {
            {0,1},{1,2},{2,4},{3,8},{4,16},{5,32},{6,64},{7,128}
        };

    }

    public class ColorConfig
    {
        public static Dictionary<int,UInt32> ColorMap =new Dictionary<int,uint>(){{0, 0xFFFFFFFF},{1, 0xFFC0C0C0},{2, 0xFF606060},{3, 0xFF000000}};
    }


    public class GBCPURegister
    {
        public static int A = 0x07,
        B = 0x00,
        C = 0x01,
        D = 0x02,
        E = 0x03,
        H = 0x04,
        L = 0x05,
        F = 0x06;
    }
}


